<!DOCTYPE html>


<html>

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

    <script>

        function myFunction() {
            console.log('===myFunction==');

            // cast_test();
            Person p = new Person();
            p.gender = 1;
            console.log(typeof p);
        }

        function set_test() {
          var s = new Set();
          s.add(1);

          [2,3,4,4,5,5,6,6].map(x => s.add(x));
          for (let i of s) {
            console.log(i + " ");
          }
          console.log('s = ', s);
          console.log('s.size = ' + s.size);

          console.log('typeof s = ' + typeof s);


        }

        function typeof_test() {
          var bFound = true;
          console.log(typeof bFound);

          var iNum = 999;
          console.log(typeof iNum);

          var underinedVar;
          console.log(typeof underinedVar);
        }

        function cast_test() {
          var s = '123455';
          var num = parseInt(s);
          console.log(num);

          s = '123red123';
          var num = parseInt(s);
          console.log(num);

          s = 'red';
          var num = parseInt(s);
          console.log(num);

          var bFoundStr = "hello";
          var bFound = Boolean(bFoundStr);
          console.log(bFound + " " + (typeof bFound));
        }

    </script>

    <head>

        <body>
            <h1>我的第一段 JavaScript</h1>

            <p>
                JavaScript 能够对事件作出反应。比如对按钮的点击：
            </p>

            <button type="button" onclick="myFunction()">点击这里</button>

        </body>

</html>
